package com.link2room.cms.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author sqj88
 * @date 2017/12/1 9:11
 */
@Entity
@Table(name = "cms_base_detail")
@DynamicInsert
public class CmsBaseDetail extends BaseEntity{
    private String categoryCode;
    private String title;
    private String url;
    private String template;
    private String descript;
    private String cmsBody;
    private String language;
    private String litPic;

    @Basic
    @Column(name = "category_code", nullable = false, length = 32)
    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }


    @Basic
    @Column(name = "title", nullable = true, length = 32)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "url", nullable = true, length = 32)
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Basic
    @Column(name = "template", nullable = true, length = -1)
    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    @Basic
    @Column(name = "descript", nullable = true, length = 512)
    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    @Basic
    @Column(name = "cms_body", nullable = true)
    public String getCmsBody() {
        return cmsBody;
    }

    public void setCmsBody(String cmsBody) {
        this.cmsBody = cmsBody;
    }

    @Basic
    @Column(name = "lit_pic", nullable = true)
    public String getLitPic() {
        return litPic;
    }

    public void setLitPic(String litPic) {
        this.litPic = litPic;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CmsBaseDetail that = (CmsBaseDetail) o;

        if (categoryCode != null ? !categoryCode.equals(that.categoryCode) : that.categoryCode != null) return false;
        if (title != null ? !title.equals(that.title) : that.title != null) return false;
        if (url != null ? !url.equals(that.url) : that.url != null) return false;
        if (template != null ? !template.equals(that.template) : that.template != null) return false;
        if (descript != null ? !descript.equals(that.descript) : that.descript != null) return false;
        if (cmsBody != null ? !cmsBody.equals(that.cmsBody) : that.cmsBody != null) return false;
        return language != null ? language.equals(that.language) : that.language == null;
    }

    @Override
    public int hashCode() {
        int result = categoryCode != null ? categoryCode.hashCode() : 0;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (template != null ? template.hashCode() : 0);
        result = 31 * result + (descript != null ? descript.hashCode() : 0);
        result = 31 * result + (cmsBody != null ? cmsBody.hashCode() : 0);
        result = 31 * result + (language != null ? language.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "language", nullable = false, length = 32)
    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    public enum CmsBase_{
        categoryCode,parentCode
    }
}
